<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <title>供应商绩效评分系统</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta content="A fully responsive admin theme which can be used to build CRM, CMS,ERP etc." name="description"/>
    <meta content="Techzaa" name="author"/>
    <link rel="shortcut icon" href="../../images/favicon.ico">
    <link href="../../vendor/datatables.net-bs5/css/dataTables.bootstrap5.min.css" rel="stylesheet" type="text/css"/>
    <link href="../../vendor/datatables.net-responsive-bs5/css/responsive.bootstrap5.min.css" rel="stylesheet"
          type="text/css"/>
    <link href="../../vendor/datatables.net-fixedcolumns-bs5/css/fixedColumns.bootstrap5.min.css" rel="stylesheet"
          type="text/css"/>
    <link href="../../vendor/datatables.net-fixedheader-bs5/css/fixedHeader.bootstrap5.min.css" rel="stylesheet"
          type="text/css"/>
    <link href="../../vendor/datatables.net-buttons-bs5/css/buttons.bootstrap5.min.css" rel="stylesheet"
          type="text/css"/>
    <link href="../../vendor/datatables.net-select-bs5/css/select.bootstrap5.min.css" rel="stylesheet"
          type="text/css"/>
    <script src="../../js/config.js"></script>
    <link href="../../css/app.min.css" rel="stylesheet" type="text/css" id="app-style"/>
    <link href="../../css/icons.min.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div class="wrapper">
    <div class="navbar-custom">
        <div class="topbar container-fluid">
            <div class="d-flex align-items-center gap-1">
                <div class="logo-topbar">
                    <a href="index.html" class="logo-light">
<span class="logo-lg">
<img src="../../images/logo.png" alt="logo">
</span>
                        <span class="logo-sm">
<img src="../../images/logo-sm.png" alt="small logo">
</span>
                    </a>
                    <a href="index.html" class="logo-dark">
<span class="logo-lg">
<img src="../../images/logo-dark.png" alt="dark logo">
</span>
                        <span class="logo-sm">
<img src="../../images/logo-sm.png" alt="small logo">
</span>
                    </a>
                </div>
                <button class="button-toggle-menu">
                    <i class="ri-menu-line"></i>
                </button>
                <button class="navbar-toggle" data-bs-toggle="collapse" data-bs-target="#topnav-menu-content">
                    <div class="lines">
                        <span></span>
                        <span></span>
                        <span></span>
                    </div>
                </button>
            </div>
            <ul class="topbar-menu d-flex align-items-center gap-3">
                <li class="dropdown d-lg-none">
                    <a class="nav-link dropdown-toggle arrow-none" data-bs-toggle="dropdown" href="#" role="button"
                       aria-haspopup="false" aria-expanded="false">
                        <i class="ri-search-line fs-22"></i>
                    </a>
                    <div class="dropdown-menu dropdown-menu-animated dropdown-lg p-0">
                        <form class="p-3">
                            <input type="search" class="form-control" placeholder="Search ..."
                                   aria-label="Recipient's username">
                        </form>
                    </div>
                </li>
                <li class="dropdown">
                    <a class="nav-link dropdown-toggle arrow-none nav-user" data-bs-toggle="dropdown" href="#"
                       role="button" aria-haspopup="false" aria-expanded="false">
<span class="account-user-avatar">
<img src="../../images/users/avatar-1.jpg" alt="user-image" width="32" class="rounded-circle">
</span>
                        <span class="d-lg-block d-none">
<h5 class="my-0 fw-normal"><span th:text="${user != null ? user.realname : '管理员用户'}">管理员用户</span> <i class="ri-arrow-down-s-line d-none d-sm-inline-block align-middle"></i></h5>
</span>
                    </a>
                    <div class="dropdown-menu dropdown-menu-end dropdown-menu-animated profile-dropdown">
                        <div class=" dropdown-header noti-title">
                            <h6 class="text-overflow m-0">欢迎 !</h6>
                        </div>
                        <a href="/user/selfinfo" class="dropdown-item">
                            <i class="ri-account-circle-line fs-18 align-middle me-1"></i>
                            <span>我的信息</span>
                        </a>
                        <a href="/user/logout" class="dropdown-item">
                            <i class="ri-logout-box-line fs-18 align-middle me-1"></i>
                            <span>退出登录</span>
                        </a>
                    </div>
                </li>
            </ul>
        </div>
    </div>
    <div class="leftside-menu">
        <a href="index.html" class="logo logo-light">
        <span class="logo-lg">
        <img src="../../images/logo-new-white.png" alt="logo">
        </span>
                    <span class="logo-sm">
        <img src="../../images/logo-sm.png" alt="small logo">
        </span>
                </a>
                <a href="index.html" class="logo logo-dark">
        <span class="logo-lg">
        <img src="../../images/logo-dark.png" alt="dark logo">
        </span>
                    <span class="logo-sm">
        <img src="../../images/logo-sm.png" alt="small logo">
        </span>
        </a>
        <div class="h-100" id="leftside-menu-container" data-simplebar>
            <ul class="side-nav">
                <li class="side-nav-title">信息管理</li>
                <li class="side-nav-item">
                    <a data-bs-toggle="collapse" href="#sidebarPages" aria-expanded="false" aria-controls="sidebarPages"
                       class="side-nav-link">
                        <i class="ri-pages-line"></i>
                        <span> 用户权限管理 </span>
                        <span class="menu-arrow"></span>
                    </a>
                    <div class="collapse" id="sidebarPages">
                        <ul class="side-nav-second-level">
                            <li>
                                <a href="/user/init">用户权限管理</a>
                            </li>
                            <li>
                                <a href="/role/init">权限设置</a>
                            </li>
                        </ul>
                    </div>
                </li>
                <li class="side-nav-item">
                    <a data-bs-toggle="collapse" href="#sidebarPages1" aria-expanded="false" aria-controls="sidebarPages"
                       class="side-nav-link">
                        <i class="ri-pages-line"></i>
                        <span> 供应商信息管理 </span>
                        <span class="menu-arrow"></span>
                    </a>
                    <div class="collapse" id="sidebarPages1">
                        <ul class="side-nav-second-level">
                            <li>
                                <a href="/supplier/detail">供应商信息录入</a>
                            </li>
                            <li>
                                <a href="/supplier/init">供应商分类管理</a>
                            </li>
                        </ul>
                    </div>
                </li>
                <li class="side-nav-title">绩效评级</li>
                <li class="side-nav-item">
                    <a data-bs-toggle="collapse" href="#sidebarPagesAuth" aria-expanded="false"
                       aria-controls="sidebarPagesAuth" class="side-nav-link">
                        <i class="ri-group-2-line"></i>
                        <span> 绩效评估模型配置 </span>
                        <span class="menu-arrow"></span>
                    </a>
                    <div class="collapse" id="sidebarPagesAuth">
                        <ul class="side-nav-second-level">
                            <li>
                                <a href="/indicator/init">指标库管理</a>
                            </li>
                            <li>
                                <a href="/weight/init">指标权重设置</a>
                            </li>
                        </ul>
                    </div>
                </li>
                <li class="side-nav-item">
                    <a data-bs-toggle="collapse" href="#sidebarLayouts" aria-expanded="false"
                       aria-controls="sidebarLayouts" class="side-nav-link">
                        <i class="ri-layout-line"></i>
                        <!--                        <span class="badge bg-warning float-end">New</span>-->
                        <span> 绩效考核数据管理 </span>
                        <span class="menu-arrow"></span>
                    </a>
                    <div class="collapse" id="sidebarLayouts">
                        <ul class="side-nav-second-level">
                            <li>
                                <a href="/data/upload">绩效考核数据导入</a>
                            </li>
                            <li>
                                <a href="/data/init">绩效考核数据查询与编辑</a>
                            </li>
                        </ul>
                    </div>
                </li>
                <li class="side-nav-item">
                    <a data-bs-toggle="collapse" href="#sidebarBaseUI" aria-expanded="false"
                       aria-controls="sidebarBaseUI" class="side-nav-link">
                        <i class="ri-briefcase-line"></i>
                        <span> 绩效评分与评级 </span>
                        <span class="menu-arrow"></span>
                    </a>
                    <div class="collapse" id="sidebarBaseUI">
                        <ul class="side-nav-second-level">
                            <li>
                                <a href="/score/init">绩效评分计算</a>
                            </li>
<!--                            <li>-->
<!--                                <a href="#">绩效评级分类</a>-->
<!--                            </li>-->
                        </ul>
                    </div>
                </li>
                <li class="side-nav-item">
                    <a data-bs-toggle="collapse" href="#sidebarExtendedUI" aria-expanded="false"
                       aria-controls="sidebarExtendedUI" class="side-nav-link">
                        <i class="ri-compasses-2-line"></i>
                        <span> 可视化报告与分析 </span>
                        <span class="menu-arrow"></span>
                    </a>
                    <div class="collapse" id="sidebarExtendedUI">
                        <ul class="side-nav-second-level">
                            <li>
                                <a href="/chart/list">可视化报告</a>
                            </li>
                            <li>
                                <a href="/chart/detail">自定义视图</a>
                            </li>
                        </ul>
                    </div>
                </li>
            </ul>
            <div class="clearfix"></div>
        </div>
    </div>
    <div class="content-page">
        <div class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-12">
                        <div class="page-title-box">
                            <div class="page-title-right">
                                <ol class="breadcrumb m-0">
                                    <li class="breadcrumb-item"><a href="javascript: void(0);">主页</a></li>
                                    <li class="breadcrumb-item active">指标库管理</li>
                                </ol>
                            </div>
                            <h4 class="page-title" id="page-title">指标库管理</h4>
                            <div id="delete-success-alert" style="display: none;" class="alert alert-success alert-dismissible text-bg-success border-0 fade show"
                                 role="alert">
                                <button type="button" class="btn-close btn-close-white" data-bs-dismiss="alert"
                                        aria-label="Close"></button>
                                <strong>删除成功 - </strong> 当前指标信息已删除!
                            </div>
                            <div id="delete-error-alert" style="display: none;" class="alert alert-danger alert-dismissible text-bg-danger border-0 fade show"
                                 role="alert">
                                <button type="button" class="btn-close btn-close-white" data-bs-dismiss="alert"
                                        aria-label="Close"></button>
                                <strong>删除失败 - </strong> 删除失败!
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-12">
                        <div class="card">
                            <div class="card-header">
                                <h4 class="header-title">指标列表</h4>
                            </div>
                            <div class="card-body">
                                <table id="scroll-vertical-datatable"
                                       class="table table-striped dt-responsive w-100">
                                    <thead>
                                    <tr>
                                        <th>ID</th>
                                        <th>名称</th>
                                        <th>描述</th>
                                        <th>数据来源</th>
                                        <th>计算公式</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr th:each="item:${indicators}">
                                        <td th:text="${item.indicatorid}">1</td>
                                        <td th:text="${item.indicatorname}">供应商资质</td>
                                        <td th:text="${item.description}">供应商资质说明A,B,C</td>
                                        <td th:text="${item.datasource}">公司信誉、财务能力</td>
                                        <td th:text="${item.formula}">公司信誉+财务能力</td>
                                        <td>
                                            <a th:href="'/indicator/edit?indicatorid='+${item.indicatorid}" class="text-reset fs-16 px-1"> <i
                                                    class="ri-settings-3-line"></i></a>
                                            <a href="javascript: void(0);" th:data-item_id="${item.indicatorid}" onclick="deleteItem(this.getAttribute('data-item_id'))" class="text-reset fs-16 px-1"> <i
                                                    class="ri-delete-bin-2-line"></i></a>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <footer class="footer">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-12 text-center">
                        <script>document.write(new Date().getFullYear())</script>
                        © 供应商绩效评分系统
                    </div>
                </div>
            </div>
        </footer>
    </div>
</div>
<script src="../../js/vendor.min.js"></script>
<script src="../../vendor/datatables.net/js/jquery.dataTables.min.js"></script>
<script src="../../vendor/datatables.net-bs5/js/dataTables.bootstrap5.min.js"></script>
<script src="../../vendor/datatables.net-responsive/js/dataTables.responsive.min.js"></script>
<script src="../../vendor/datatables.net-responsive-bs5/js/responsive.bootstrap5.min.js"></script>
<script src="../../vendor/datatables.net-fixedcolumns-bs5/js/fixedColumns.bootstrap5.min.js"></script>
<script src="../../vendor/datatables.net-fixedheader/js/dataTables.fixedHeader.min.js"></script>
<script src="../../vendor/datatables.net-buttons/js/dataTables.buttons.min.js"></script>
<script src="../../vendor/datatables.net-buttons-bs5/js/buttons.bootstrap5.min.js"></script>
<script src="../../vendor/datatables.net-buttons/js/buttons.html5.min.js"></script>
<script src="../../vendor/datatables.net-buttons/js/buttons.flash.min.js"></script>
<script src="../../vendor/datatables.net-buttons/js/buttons.print.min.js"></script>
<script src="../../vendor/datatables.net-keytable/js/dataTables.keyTable.min.js"></script>
<script src="../../vendor/datatables.net-select/js/dataTables.select.min.js"></script>
<script src="../../js/pages/datatable.init.js"></script>
<script src="../../js/app.min.js"></script>
</body>
<style>
    .dataTables_scrollBody{
        max-height: 600px !important;
    }
</style>
<script>
    function deleteItem(id) {
        if (confirm("确认删除该条记录吗？")) {
            $.ajax({
                url: '/indicator/delete/' + id,
                type: 'post',
                // data: JSON.stringify(data),
                contentType: "application/json;charset=UTF-8",
                dataType: 'json',
                success: function (res) {
                    let alert = $('#delete-success-alert').clone();
                    alert.prop('id', 'delete-success-alert-clone');
                    $('#page-title').after(alert);
                    alert.show();
                    setTimeout(function () {
                        location.reload(true);
                    }, 1000);
                },
                error: function (res) {
                    let alert = $('#delete-error-alert').clone();
                    alert.prop('id', 'delete-error-alert-clone');
                    $('#page-title').after(alert);
                    alert.show();
                }
            });
        }
    }
</script>
</html>